package ru.ifmo.ct.network.brafs.file;

/**
* @author Alex Vikharev vikharev@yandex-team.ru
*         created 20.04.12
*/
public class SegmentId {
    final String name;
    final long id;

    public SegmentId(final String name, final long id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public long getId() {
        return id;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        final SegmentId segmentId1 = (SegmentId) o;

        if (id != segmentId1.id) return false;
        if (name != null ? !name.equals(segmentId1.name) : segmentId1.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (int) (id ^ (id >>> 32));
        return result;
    }
}
